package cn.itsource.basic.controller;

import cn.itsource.basic.service.IVerifyCodeService;
import cn.itsource.basic.util.AjaxResult;
import cn.itsource.org.domain.dto.UserSmsCodeDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;

    /**
     * 生成图形验证码
     * @param uuid
     * @return
     */
    @GetMapping("/image/{uuid}")
    public AjaxResult imgCode(@PathVariable("uuid") String uuid){
        return verifyCodeService.imgCode(uuid);
    }


    @PostMapping("/user_smscode")
    public AjaxResult userSmscode(@RequestBody UserSmsCodeDto dto) throws IOException {
        return verifyCodeService.userSmscode(dto);
    }
}
